%
%   Style file for the drawing of Feynman diagrams with LaTeX.
%   It assumes that the dvips that is used is by Radical Eye Software
%   (by Rokicki), because the graphics primitives are given in
%   postscript. If you do not work with a dvi to postscript converter
%   you are out of luck.
%
%   Made by J.A.M. Vermaseren 14-feb-1994
%
%   Use:
%   Enter the picture environment with for instance
%   \begin{picture}(width,height)(0,0)
%       statements
%   \end{picture}
%   All statements should be entered inside the picture environment.
%   All coordinates should be in terms of pt (but the pt must be omitted).
%   One may also use the figure environment.
%
%	This version has been enhanced to help in drawing sudoku puzzles.
%
\input{epsf.sty}
\openin5=colordvi.sty
\ifeof5
    \closein5
    \def\axocolor{ }
    \def\SetColor#1{ }
    \def\Color#1#2{#2}
	\def\IfColor#1#2{#2 }
\else
    \closein5
    \input{colordvi.sty}
    \background{White}
    \textBlack
    \def\axocolor{Black }
    \def\SetColor#1{\def\axocolor{#1 }}
	\def\IfColor#1#2{#1}
\fi
%		#[ inventory :
%
%   The variables in are:
%   mtrx,num,ampi,x1,y1,x2,y2,x3,y3,dx,dy,dr,speed
%   step,phi,arcend,arcstart,radius
%   theindex,thechar,darc,const,amp1 amp2 amp3
%   gcolor,xx,name,name1,name2,xx1,xx2
%
%   NOTE: blank lines are not allowed inside the postscript code!!!!!
%   (LaTeX sneaks \par commands in and the postscript goes boink)
%
\special{! /ed{exch def}def /gs{gsave dup scale}def
/gsw{gs /width ed width setlinewidth}def
/p1{/y1 ed /x1 ed}def
/p2{/y2 ed /x2 ed}def
/p3{/y3 ed /x3 ed}def
/abox{newpath x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto closepath}def
/atriangle{newpath x1 y1 moveto x2 y2 lineto x3 y3 lineto closepath}def
%
%	Color definitions that are not in the standard setup
%
/LightYellow{0 0 0.7 0 setcmykcolor}def
/LightRed{0 0.75 0.7 0 setcmykcolor}def
/LightBlue{0.7 0.5 0 0 setcmykcolor}def
}
%
%		#] inventory :
%		#[ arrowdown :
%
\special{! /arrowdown{
    /nwidth { width 1 add } def
    newpath
        0 nwidth 1.5 mul neg moveto         % Arrow is a triangle
        nwidth 1.2 mul nwidth 3 mul rlineto
        nwidth 2.4 mul neg 0 rlineto
        nwidth 1.2 mul nwidth 3 mul neg rlineto
    closepath fill                          % and it is filled
} def }
%
%		#] arrowdown :
%		#[ arrowup :
%
\special{! /arrowup{
    /nwidth { width 1 add } def
    newpath
        0 nwidth 1.5 mul moveto             % Arrow is a triangle
        nwidth 1.2 mul nwidth 3 mul neg rlineto
        nwidth 2.4 mul neg 0 rlineto
        nwidth 1.2 mul nwidth 3 mul rlineto
    closepath fill                          % and it is filled
} def }
%
%		#] arrowup :
%		#[ arrowright :
%
\special{! /arrowright{
    /nwidth { width 1 add } def
    newpath
        nwidth 1.5 mul 0 moveto             % Arrow is a triangle
        nwidth 3 mul neg nwidth 1.2 mul rlineto
        0 nwidth 2.4 mul neg rlineto
        nwidth 3 mul nwidth 1.2 mul rlineto
    closepath fill                          % and it is filled
} def }
%
%		#] arrowright :
%		#[ gluon :
%
\special{! /gluon{
    gsw /num ed /ampi ed /dy ed /dx ed p1
    /dy dy y1 sub def /dx dx x1 sub def
%
%   We have a 'head' and a 'tail' and inbetween the 'body'
%   The head + tail is 2 windings. The body is num-1 windings.
%
    /dr dx dx mul dy dy mul add sqrt def
%
    x1 y1 translate dy dx atan rotate
%
    /num num 0.5 sub round def
    /inc dr num 2 mul 2 add div def         % increment per half winding
    /amp8 ampi 0.9 mul def
    amp8 0 lt {/amp8 amp8 neg def} if
%
    /x1 inc 2 mul def
%
    newpath
        0 0 moveto
        inc 0.1 mul ampi 0.5 mul inc 0.5 mul ampi inc 1.4 mul ampi curveto
        x1 amp8 add dup ampi exch ampi neg dup x1 exch curveto
%
        2 1 num {
            pop
            x1 amp8 sub dup ampi neg exch ampi dup x1 inc add exch curveto
            /x1 x1 inc dup add add def
            x1 amp8 add dup ampi exch ampi neg dup x1 exch curveto
        } for
%
        x1 amp8 sub dup ampi neg exch ampi dup x1 inc 0.6 mul add exch curveto
        x1 inc 1.5 mul add ampi dr inc 0.1 mul sub ampi 0.5 mul dr 0 curveto
    stroke
%
    grestore
} def }
%
%		#] gluon :
%		#[ photon :
%
\special{! /photon{
%
%   Draws a photon from x1,y1 to x2,y2 with amplitude A and n wiggles
%
    gsw /num ed /ampi ed p2 p1
    /dy y2 y1 sub def /dx x2 x1 sub def
    /dr dx dx mul dy dy mul add sqrt def
%
    x1 y1 translate
    dy dx atan rotate
    /num num 2 mul 0.5 sub round def
    /x2 dr num div def
    /pi 3.141592 def
    /sign 1 def
    1 1 num {
        pop
        newpath
        0 0 moveto
        4 3 div x2 mul pi div dup neg x2 add
        4 3 div ampi sign mul mul dup 3 1 roll
        x2 0 curveto
        stroke
        /sign sign neg def
        x2 0 translate
    } for
%
    grestore
} def }
%
%		#] photon :
%		#[ zigzag :
%
\special{! /zigzag{
%
%   Draws a zigzag line from x1,y1 to x2,y2 with amplitude A and n zigzags
%
    gsw /num ed /ampi ed p2 p1
    /dy y2 y1 sub def /dx x2 x1 sub def
    /dr dx dx mul dy dy mul add sqrt def
%
    x1 y1 translate
    dy dx atan rotate
    /num num 2 mul 0.5 sub round def
    /x2 dr num div def
    /pi 3.141592 def
    /sign 1 def
    1 1 num {
        pop
        newpath
        0 0 moveto
        x2 2 div ampi sign mul lineto
        x2 0 lineto
        stroke
        /sign sign neg def
        x2 0 translate
    } for
%
    grestore
} def }
%
%		#] zigzag :
%		#[ photonarc :
%
\special{! /photonarc{
%
%   Draws a photonarc center at x1,y1, radius arcstart,arcend, amplitude
%       number of wiggles,  width, scale
%
    gsw /num ed /ampli ed /arcend ed /arcstart ed /radius ed
%
    translate       % The center of the circle is now the origin
%
    /num num 2 mul round def    % number of half wiggles
    arcend arcstart lt { /arcend arcend 360 add def } if
    /arcend arcend arcstart sub num div def    % phi
    arcstart rotate
    /arcstart arcend 2 div def                 % phi/2
    /cp arcend cos def
    /sp arcend sin def
    /cp2 arcstart cos def
    /sp2 arcstart sin def
%
    newpath
    1 1 num {
        pop
        radius 0 moveto
        /beta radius arcend mul 180 ampli mul div def
        /tt sp cp beta mul sub cp sp beta mul add div def
        /amp1 radius ampli add 8 mul beta cp2 mul sp2 sub mul beta 4 cp add mul
            tt cp mul 3 mul sp 4 mul sub add radius mul sub
            beta tt sub 3 mul div def           % this is x2
        radius ampli add 8 mul cp2 mul 1 cp add radius mul sub 3 div amp1 sub
            dup radius sub beta mul             % x1,y1
        amp1 dup radius cp mul sub tt mul radius sp mul add     % x2,y2
        radius cp mul radius sp mul             % x3 y3
                curveto
        /ampli ampli neg def
        arcend rotate
    } for
    stroke
%
    grestore
} def }
%
%		#] photonarc :
%		#[ gluearc :
%
\special{! /gluearc{
%
%   Draws a gluon on an arcsegment
%   x_center,y_center,radius,stat_angle,end_angle,gluon_radius,num
%   in which num is the number of windings of the gluon.
%   Method:
%   1:  compute length of arc.
%   2:  generate gluon in x and y as if the arc is a straight line
%   3:  x' = (radius+y)*cos(x*const)
%       y' = (radius+y)*sin(x*const)
%
    gsw /num ed /ampi ed /arcend ed /arcstart ed /radius ed
%
%	When arcend comes before arcstart we have a problem. The solution is
%	to flip the order and change the sign on ampi
%
	arcend arcstart lt {
		/ampi ampi -1 mul def
		/arcstart arcend /arcend arcstart def def
	} if
%
    translate                               % move to center of circle
    arcstart rotate                         % segment starts at zero
    /darc arcend arcstart sub def           % argsegment
%
    /dr darc 180 div 3.141592 mul radius mul def  % length of segment.
%
    /const darc dr div def                  % conversion constant
%
    /num num 0.5 sub round def
    /inc dr num 2 mul 2 add div def         % increment per half winding
%
    /amp8 ampi 0.9 mul def
    /amp1 radius ampi add def
    /amp2 radius ampi sub def
    /amp3 radius ampi 2 div add def
    /amp4 amp1 inc amp8 add const mul cos div def
    /amp5 amp2 amp8 const mul cos div def
    /amp6 amp1 inc 0.6 mul amp8 add const mul cos div def
    /amp7 amp1 inc 0.9 mul const mul cos div def
    amp8 0 lt {/amp8 amp8 neg def} if
%
    /x1 inc 2 mul def
%
    newpath
        radius 0 moveto
%
        inc 0.1 mul const mul dup cos amp3 mul exch sin amp3 mul
        inc 0.5 mul const mul dup cos amp7 mul exch sin amp7 mul
        inc 1.4 mul const mul dup cos amp1 mul exch sin amp1 mul
            curveto
        x1 amp8 add const mul dup cos amp6 mul exch sin amp6 mul
        x1 amp8 add const mul dup cos amp5 mul exch sin amp5 mul
        x1 const mul dup cos amp2 mul exch sin amp2 mul
            curveto
%
        2 1 num {
            pop
            x1 amp8 sub const mul dup cos amp5 mul exch sin amp5 mul
            x1 amp8 sub const mul dup cos amp4 mul exch sin amp4 mul
            x1 inc add const mul dup cos amp1 mul exch sin amp1 mul
                curveto
            /x1 x1 inc dup add add def
            x1 amp8 add const mul dup cos amp4 mul exch sin amp4 mul
            x1 amp8 add const mul dup cos amp5 mul exch sin amp5 mul
            x1 const mul dup cos amp2 mul exch sin amp2 mul
                curveto
        } for
%
        x1 amp8 sub const mul dup cos amp5 mul exch sin amp5 mul
        x1 amp8 sub const mul dup cos amp6 mul exch sin amp6 mul
        x1 inc 0.6 mul add const mul dup cos amp1 mul exch sin amp1 mul
            curveto
        x1 inc 1.5 mul add const mul dup cos amp7 mul exch sin amp7 mul
        dr inc 0.1 mul sub const mul dup cos amp3 mul exch sin amp3 mul
        dr const mul dup cos radius mul exch sin radius mul
        curveto
    stroke
%
    grestore
} def }
%
%		#] gluearc :
%		#[ arrowarc :
%
\special{! /arrowarc{
%
%   Draws an anticlockwise arc with an arrow in the middle
%   The arc is   x_center, y_center, radius, start_angle, end_angle
%
    gsw /arcend ed /arcstart ed /radius ed
%
    translate                               % x and y are still on stack
    newpath 0 0 radius arcstart arcend arc stroke
    arcstart arcend gt {
        /arcend arcend 360 add def } if
    arcstart arcend add 2 div rotate        % middle of arc
    radius 0 translate                      % move to it
    arrowup
    grestore
} def }
%
%		#] arrowarc :
%		#[ longarrowarc :
%
\special{! /longarrowarc{
%
%   Draws an anticlockwise arc with an arrow at the end
%   The arc is   x_center, y_center, radius, start_angle, end_angle
%
    gsw /arcend ed /arcstart ed /radius ed
%
    translate                               % x and y are still on stack
    arcstart arcend gt {
        /arcend arcend 360 add def } if
    /arcmid 540 width 1 add mul 3.14159 div radius div def
                                            % discount for arrow
    newpath 0 0 radius arcstart arcend arcmid sub arc stroke
    arcend arcmid 2 div sub rotate          % middle of arrow
    radius 0 translate                      % move to it
    arrowup
    grestore
} def }
%
%		#] longarrowarc :
%		#[ dasharrowarc :
%
\special{! /dasharrowarc{
%
%   Draws a dashed anticlockwise arc with an arrow in the middle
%   The arc is   x_center, y_center, radius, start_angle, end_angle dsize
%
    gsw /dsize ed /arcend1 ed /arcstart1 ed /radius ed
%
    translate                               % x and y are still on stack
%
    arcend1 arcstart1 lt { /arcend1 arcend1 360 add def } if
    /arcmid1 arcend1 arcstart1 add 2 div def
%
    0 0 radius arcstart1 arcmid1 dsize width 1 dashcarc
    0 0 radius arcmid1 arcend1 dsize width 1 dashcarc
    arcmid1 rotate
    radius 0 translate
    arrowup
    grestore
} def }
%
%		#] dasharrowarc :
%		#[ arrowarcn :
%
\special{! /arrowarcn{
%
%   Draws a clockwise arc with an arrow in the middle
%   The arc is   x_center, y_center, radius, start_angle, end_angle
%
    gsw /arcend ed /arcstart ed /radius ed
%
    translate                               % x and y are still on stack
    newpath 0 0 radius arcstart arcend arcn stroke
    arcstart arcend lt {
        /arcstart arcstart 360 add def } if
    arcstart arcend add 2 div rotate        % middle of arc
    radius 0 translate                      % move to it
    arrowdown
    grestore
} def }
%
%		#] arrowarcn :
%		#[ longarrowarcn :
%
\special{! /longarrowarcn{
%
%   Draws a clockwise arc with an arrow in the end
%   The arc is   x_center, y_center, radius, start_angle, end_angle
%
    gsw /arcend ed /arcstart ed /radius ed
%
    translate                               % x and y are still on stack
    arcstart arcend lt {
        /arcstart arcstart 360 add def } if
    /arcmid 540 width 1 add mul 3.14159 div radius div def
                                            % correction for arrow
    newpath 0 0 radius arcstart arcend arcmid add arcn stroke
    arcend arcmid 2 div add rotate          % middle of arrow
    radius 0 translate                      % move to it
    arrowdown
    grestore
} def }
%
%		#] longarrowarcn :
%		#[ dasharrowarcn :
%
\special{! /dasharrowarcn{
%
%   Draws a dashed clockwise arc with an arrow in the middle
%   The arc is   x_center, y_center, radius, start_angle, end_angle
%
    gsw /dsize ed /arcend1 ed /arcstart1 ed /radius ed
%
    translate                               % x and y are still on stack
    arcstart1 arcend1 lt {
        /arcstart1 arcstart1 360 add def } if
    /arcmid1 arcstart1 arcend1 add 2 div def
    0 0 radius arcmid1 arcstart1 dsize width 1 dashcarc
    0 0 radius arcend1 arcmid1 dsize width 1 dashcarc
    arcmid1 rotate
    radius 0 translate
    arrowdown
    grestore
} def }
%
%		#] dasharrowarcn :
%		#[ arrowline :
%
\special{! /arrowline{
%
%   Draws a straight line with an arrow in the middle
%   x1,y1,x2,y2
%
    gsw p2 p1
    /dx x2 x1 sub def /dy y2 y1 sub def
    /dr dx dx mul dy dy mul add sqrt def
%
    x1 y1 translate
    newpath
        0 0 moveto
        dx dy rlineto
    stroke
    dy dx atan rotate
    dr 2.0 div 0 translate
    arrowright
    grestore
} def }
%
%		#] arrowline :
%		#[ longarrow :
%
\special{! /longarrow{
%
%   Draws a straight line with an arrow at the end
%   x1,y1,x2,y2
%
    gsw p2 p1
    /dx x2 x1 sub def /dy y2 y1 sub def
    /dr dx dx mul dy dy mul add sqrt def
%
    x1 y1 translate
    dy dx atan rotate
    newpath
        0 0 moveto
        dr width 3 mul sub 0 rlineto
    stroke
    dr width 1.5 mul sub 0 translate
    arrowright
    grestore
} def }
%
%		#] longarrow :
%		#[ dasharrowline :
%
\special{! /dasharrowline{
%
%   Draws a straight dashed line with an arrow in the middle
%   x1,y1,x2,y2
%
%   The pattern is ideally [dsize dsize] 0 setdash
%   but we want to have (2*n+1)/2 patterns, so dsize must be rounded
%   Actually we want the center to be black too so that the arrow
%   fits in nice. This means that n must be odd. So
%   r = dsize*(4*m+3)
%
    gsw /dsize ed p2 p1
    /dx x2 x1 sub def /dy y2 y1 sub def
    /dr dx dx mul dy dy mul add sqrt 2 div def
%
    x1 y1 translate
    dy dx atan rotate
%
    0 0 dr 0 dsize width 1 dashline
    dr 0 translate
    0 0 dr 0 dsize width 1 dashline
    arrowright
    grestore
} def }
%
%		#] dasharrowline :
%		#[ line :
%
\special{! /line{
%
%   Draws a straight line: x1,y1,x2,y2
%
    gsw p2 p1
%
    newpath
      x1 y1 moveto
      x2 y2 lineto
    stroke
    grestore
} def }
%
%		#] line :
%		#[ dashline :
%
\special{! /dashline{
%
%   Draws a straight dashed line: x1,y1,x2,y2,dsize
%
%   The pattern is ideally [dsize dsize] 0 setdash
%   but we want to have (2*n+1)/2 patterns, so dsize must be rounded
%
    gsw /dsize ed p2 p1
    /r y2 y1 sub dup mul x2 x1 sub dup mul add sqrt def
    /dsize r dsize 2 mul div 0.5 sub round dup 0 le { pop 0 } if 2 mul 1 add
    r exch div def
    [dsize dsize] 0 setdash
%
    newpath
      x1 y1 moveto
      x2 y2 lineto
    stroke
    grestore
} def }
%
%		#] dashline :
%		#[ carc :
%
\special{! /carc{
%
%   Draws an anti-clockwise arc segment:
%   x_center, y_center, radius, start_angle, end_angle
%
    gsw /arcend ed /arcstart ed /radius ed
%
    translate                               % x and y are still on stack
    newpath 0 0 radius arcstart arcend arc stroke
    grestore
} def }
%
%		#] carc :
%		#[ dashcarc :
%
\special{! /dashcarc{
%
%   Draws an anti-clockwise arc segment:
%   x_center, y_center, radius, start_angle, end_angle, dsize
%
    gsw /dsize ed /arcend ed /arcstart ed /radius ed
%
    translate                               % x and y are still on stack
%
%   Compute the length of the line
%
    /dr arcend arcstart sub dup 0 lt { 360 add } if
        3.14159 mul 180 div radius mul def
    /dsize dr dsize 2 mul div 0.5 sub round dup 0 le { pop 0 } if 2 mul 1 add
    dr exch div def
    [dsize dsize] 0 setdash
%
    newpath 0 0 radius arcstart arcend arc stroke
    grestore
} def }
%
%		#] dashcarc :
%		#[ vertex :
%
\special{! /vertex{
%
%   Puts a fat dot at x,y  size is the radius of the dot
%
    gs
    /dotsize ed
    translate
    newpath
        0 0 dotsize 0 360 arc
    fill stroke
    grestore
} def }
%
%		#] vertex :
%		#[ cross :
%
\special{! /cross{
%
%   Draws a cross under 45 degrees: x,y,size,width,scale
%
    gsw /csize ed p1
%
    newpath
      x1 csize add y1 csize add moveto
      x1 csize sub y1 csize sub lineto
    stroke
    newpath
      x1 csize add y1 csize sub moveto
      x1 csize sub y1 csize add lineto
    stroke
    grestore
} def }
%
%		#] cross :
%		#[ bcirc :
%
\special{! /bcirc{
%
%   Draws an anti-clockwise blanked circle:
%   x_center, y_center, radius
%
    gsw /radius ed
%
    translate                               % x and y are still on stack
%
    gsave
    1 setgray
    newpath 0 0 radius 0 360 arc fill
    grestore
    newpath 0 0 radius 0 360 arc stroke
    grestore
} def }
%
%		#] bcirc :
%		#[ gcirc :
%
\special{! /gcirc{
%
%   Draws an anti-clockwise blanked gray circle:
%   x_center, y_center, radius, grayscale
%
    gsw /gcolor ed /radius ed
%
    translate                               % x and y are still on stack
%
    1 setgray
    newpath 0 0 radius 0 360 arc fill
    gcolor setgray
    newpath 0 0 radius 0 360 arc fill
    0 setgray
    newpath 0 0 radius 0 360 arc stroke
    grestore
} def }
%
%		#] gcirc :
%		#[ ccirc1 :
%
\special{! /ccirc1{
%
%   Draws an anti-clockwise circle :
%   x_center, y_center, radius
%   Part 1: the contents in background color
%
    gsw /radius ed
%
    translate                               % x and y are still on stack
%
    newpath 0 0 radius 0 360 arc fill
    grestore
} def }
%
%		#] ccirc1 :
%		#[ ccirc2 :
%
\special{! /ccirc2{
%
%   Draws an anti-clockwise circle :
%   x_center, y_center, radius
%   Part 1: the contents in background color
%
    gsw /radius ed
%
    translate                               % x and y are still on stack
%
    newpath 0 0 radius 0 360 arc stroke
    grestore
} def }
%
%		#] ccirc2 :
%		#[ box :
%
\special{! /box{
%
%   Draws a box x1,y1,x2,y2
%
    gsw p2 p1
    abox stroke
    grestore
} def }
%
%		#] box :
%		#[ bbox :
%
\special{! /bbox{
%
%   Draws a blanked out box x1,y1,x2,y2
%
    gsw p2 p1
    gsave
    1 setgray abox fill
    grestore
    abox stroke
    grestore
} def }
%
%		#] bbox :
%		#[ gbox :
%
\special{! /gbox{
%
%   Draws a blanked out gray box x1,y1,x2,y2,color
%
    gsw /gcolor ed p2 p1
    1 setgray      abox fill
    gcolor setgray abox fill
    0 setgray      abox stroke
    grestore
} def }
%
%		#] gbox :
%		#[ cbox1 :
%
\special{! /cbox1{
%
%   Draws a blanked out colored box x1,y1,x2,y2
%   Part 1: the background
%
    gsw p2 p1
    abox fill
    grestore
} def }
%
%		#] cbox1 :
%		#[ cbox2 :
%
\special{! /cbox2{
%
%   Draws a blanked out colored box x1,y1,x2,y2
%   Part 1: the box
%
    gsw p2 p1
    abox stroke
    grestore
} def }
%
%		#] cbox2 :
%		#[ cbox3 :
%
%	Draws a square colored box of which the center and half the size are given
%
\special{! /cbox3{
%
%   Draws an anti-clockwise circle :
%   x_center, y_center, radius
%   Part 1: the contents in background color
%
    gsw /radius ed
%
    translate                               % x and y are still on stack
%
	newpath radius neg radius neg moveto radius radius neg lineto
	radius radius lineto radius neg radius lineto closepath fill
    grestore
} def }
%
%		#] cbox3 :
%		#[ triangle :
%
\special{! /triangle{
%
%   Draws a triangle x1,y1,x2,y2,x3,y3
%
    gsw p3 p2 p1
    atriangle stroke
    grestore
} def }
%
%		#] triangle :
%		#[ btriangle :
%
\special{! /btriangle{
%
%   Draws a blanked out triangle x1,y1,x2,y2,x3,y3
%
    gsw p3 p2 p1
    gsave
    1 setgray atriangle fill
    grestore
    atriangle stroke
    grestore
} def }
%
%		#] btriangle :
%		#[ gtriangle :
%
\special{! /gtriangle{
%
%   Draws a blanked out gray triangle x1,y1,x2,y2,x3,y3,color
%
    gsw /gcolor ed p3 p2 p1
    1 setgray      atriangle fill
    gcolor setgray atriangle fill
    0 setgray      atriangle stroke
    grestore
} def }
%
%		#] gtriangle :
%		#[ ctriangle1 :
%
\special{! /ctriangle1{
%
%   Draws a blanked out colored triangle x1,y1,x2,y2,x3,y3
%   Part 1: the background
%
    gsw p3 p2 p1
    atriangle fill
    grestore
} def }
%
%		#] ctriangle1 :
%		#[ ctriangle2 :
%
\special{! /ctriangle2{
%
%   Draws a blanked out colored triangle x1,y1,x2,y2,x3,y3
%   Part 1: the triangle
%
    gsw p3 p2 p1
    atriangle stroke
    grestore
} def }
%
%		#] ctriangle2 :
%		#[ btext :
%
\special{! /btext{
%
%       Makes a box that has the text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,text,fontsize,linewidth,scale
%
    gsw /fsize ed /thetext ed translate
    /hsize thetext stringwidth pop def
    /x1 hsize fsize add 2 div neg def
    /y1 fsize 2 mul 3 div neg def
    /x2 x1 neg def /y2 y1 neg def
    gsave 1 setgray abox fill grestore
    abox stroke
    hsize 2 div neg fsize 3 div neg moveto thetext show
    grestore    
} def }
%
%		#] btext :
%		#[ b2text :
%
\special{! /b2text{
%
%       Makes a box that has two lines of text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,text1,text2,fontsize,linewidth,scale
%
    gsw /fsize ed /text2 ed /text1 ed translate
    /hsize1 text1 stringwidth pop def
    /hsize2 text2 stringwidth pop def
    hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
    /x1 hsize fsize add 2 div neg def
    /y1 fsize neg 7 mul 6 div def
    /x2 x1 neg def /y2 y1 neg def
    gsave 1 setgray abox fill grestore
    abox stroke
    hsize1 2 div neg fsize 6 div moveto text1 show
    hsize2 2 div neg fsize 5 mul 6 div neg moveto text2 show
    grestore    
} def }
%
%		#] b2text :
%		#[ gtext :
%
\special{! /gtext{
%
%       Makes a gray box that has the text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,gray,text,fontsize,linewidth,scale
%
    gsw /fsize ed /thetext ed /graysc ed translate
    /hsize thetext stringwidth pop def
    /x1 hsize fsize add 2 div neg def
    /y1 fsize 2 mul 3 div neg def
    /x2 x1 neg def /y2 y1 neg def
    graysc setgray abox fill 0 setgray abox stroke
    hsize 2 div neg fsize 3 div neg moveto thetext show
    grestore    
} def }
%
%		#] gtext :
%		#[ ctext1 :
%
\special{! /ctext1{
%
%       Makes a colored box that has the text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,text,fontsize,linewidth,scale
%       Part 1: the background
%
    gsw /fsize ed /thetext ed translate
    /hsize thetext stringwidth pop def
    /x1 hsize fsize add 2 div neg def
    /y1 fsize 2 mul 3 div neg def
    /x2 x1 neg def /y2 y1 neg def
    abox fill
    grestore    
} def }
%
%		#] ctext1 :
%		#[ ctext2 :
%
\special{! /ctext2{
%
%       Makes a colored box that has the text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,text,fontsize,linewidth,scale
%       Part 2: the box and the text
%
    gsw /fsize ed /thetext ed translate
    /hsize thetext stringwidth pop def
    /x1 hsize fsize add 2 div neg def
    /y1 fsize 2 mul 3 div neg def
    /x2 x1 neg def /y2 y1 neg def
    abox stroke
    hsize 2 div neg fsize 3 div neg moveto thetext show
    grestore    
} def }
%
%		#] ctext2 :
%		#[ g2text :
%
\special{! /g2text{
%
%       Makes a gray box that has two lines of text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,gray,text1,text2,fontsize,linewidth,scale
%
    gsw /fsize ed /text2 ed /text1 ed /graysc ed translate
    /hsize1 text1 stringwidth pop def
    /hsize2 text2 stringwidth pop def
    hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
    /x1 hsize fsize add 2 div neg def
    /y1 fsize neg 7 mul 6 div def
    /x2 x1 neg def /y2 y1 neg def
    graysc setgray abox fill 0 setgray abox stroke
    hsize1 2 div neg fsize 6 div moveto text1 show
    hsize2 2 div neg fsize 5 mul 6 div neg moveto text2 show
    grestore    
} def }
%
%		#] g2text :
%		#[ c2text1 :
%
\special{! /c2text1{
%
%       Makes a colored box that has two lines of text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,text1,text2,fontsize,linewidth,scale
%       Part 1: the background
%
    gsw /fsize ed /text2 ed /text1 ed translate
    /hsize1 text1 stringwidth pop def
    /hsize2 text2 stringwidth pop def
    hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
    /x1 hsize fsize add 2 div neg def
    /y1 fsize neg 7 mul 6 div def
    /x2 x1 neg def /y2 y1 neg def
    abox fill
    grestore    
} def }
%
%		#] c2text1 :
%		#[ c2text2 :
%
\special{! /c2text2{
%
%       Makes a colored box that has two lines of text centered in it
%       The center of the box is at x,y and the box is just large enough
%       for the text.
%       x,y,text1,text2,fontsize,linewidth,scale
%       Part 2, box and text
%
    gsw /fsize ed /text2 ed /text1 ed translate
    /hsize1 text1 stringwidth pop def
    /hsize2 text2 stringwidth pop def
    hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
    /x1 hsize fsize add 2 div neg def
    /y1 fsize neg 7 mul 6 div def
    /x2 x1 neg def /y2 y1 neg def
    abox stroke
    hsize1 2 div neg fsize 6 div moveto text1 show
    hsize2 2 div neg fsize 5 mul 6 div neg moveto text2 show
    grestore    
} def }
%
%		#] c2text2 :
%		#[ ptext :
%
\special{! /ptext{
%
%   Puts a text at x,y (focal point)
%   phi is a rotation angle
%   Mode tells how the text should be w.r.t. the focal point.
%   fsize is the fontsize
%   Then the text is given.
%   Finally the scale factor should be there
%
    gs
    /text ed
    /fsize ed
    /mode ed
    3 1 roll
    translate rotate    % We are at the focus and have the proper orientation
    mode 3 lt { 0 fsize neg translate } {
        mode 6 lt { /mode mode 3 sub def 0 fsize 2 div neg translate }
        { /mode mode 6 sub def } ifelse } ifelse
    /fsize text stringwidth pop def
    mode 1 eq { fsize 2 div neg 0 translate } {
        mode 2 eq { fsize neg 0 translate } if } ifelse
    0 0 moveto
    text show
    grestore
} def }
%
%		#] ptext :
%		#[ goval :
%
\special{! /goval{
%
%   Draws a colored oval that overwrites whatever was there.
%   x_center y_center height width rotation color linewidth scale
%
    gsw /gcolor ed /x1 ed /x2 ed /radius ed
%
    translate                               % x and y are still on stack
    x1 rotate
    x2 radius div 1.0 scale
    1 setgray      newpath 0 0 radius 0 360 arc fill
    gcolor setgray newpath 0 0 radius 0 360 arc fill
    0 setgray      newpath 0 0 radius 0 360 arc stroke
    grestore
} def }
%
%		#] goval :
%		#[ coval1 :
%
\special{! /coval1{
%
%   Draws a oval that overwrites whatever was there.
%   x_center y_center height width rotation linewidth scale
%
    gsw /x1 ed /x2 ed /radius ed
%
    translate                               % x and y are still on stack
    x1 rotate
    x2 radius div 1.0 scale
    newpath 0 0 radius 0 360 arc fill
    grestore
} def }
%
%		#] coval1 :
%		#[ coval2 :
%
\special{! /coval2{
%
%   Draws a oval that overwrites whatever was there.
%   x_center y_center height width rotation linewidth scale
%
    gsw /x1 ed /x2 ed /radius ed
%
    translate                               % x and y are still on stack
    x1 rotate
    x2 radius div 1.0 scale
    newpath 0 0 radius 0 360 arc stroke
    grestore
} def }
%
%		#] coval2 :
%		#[ oval :
%
\special{! /oval{
%
%   Draws an oval that does not overwrite whatever was there.
%   x_center y_center height width rotation linewidth scale
%
    gsw /x1 ed /x2 ed /radius ed
%
    translate                               % x and y are still on stack
    x1 rotate
    x2 radius div 1.0 scale
%
    newpath 0 0 radius 0 360 arc stroke
    grestore
} def }
%
%		#] oval :
%		#[ makecurve :
%
\special{! /docurve{
    x1 2 mul x2 add 3 div
        y1 y0 sub x1 x0 sub div x2 x0 sub mul
        y2 y0 sub x2 x0 sub div x1 x0 sub mul add
        y1 add y0 2 mul add 3 div
    x1 x2 2 mul add 3 div
        y2 y3 sub x2 x3 sub div x1 x3 sub mul
        y1 y3 sub x1 x3 sub div x2 x3 sub mul add
        y2 add y3 2 mul add 3 div
    x2 y2 curveto
} def }
%
\special{! /makecurve{
%
%   Incoming stack:
%   [array of x,y pairs] width scale
%
    gsw /points ed
    /ss points length 2 idiv 2 mul def
    newpath
    ss 4 gt {
        /x1 points 0 get def
        /y1 points 1 get def
        /x2 points 2 get def
        /y2 points 3 get def
        /x3 points 4 get def
        /y3 points 5 get def
        /x0 x1 2 mul x2 sub def
        /y0 y3 y2 sub x3 x2 sub div y2 y1 sub x2 x1 sub div sub 2 mul
            x2 x1 sub dup mul x3 x1 sub div mul
            y1 2 mul add y2 sub def
        x1 y1 moveto
        docurve
        0 2 ss 8 sub { /ii ed
            /x0 points ii       get def
            /y0 points ii 1 add get def
            /x1 points ii 2 add get def
            /y1 points ii 3 add get def
            /x2 points ii 4 add get def
            /y2 points ii 5 add get def
            /x3 points ii 6 add get def
            /y3 points ii 7 add get def
            docurve
        } for
        /x0 points ss 6 sub get def
        /y0 points ss 5 sub get def
        /x1 points ss 4 sub get def
        /y1 points ss 3 sub get def
        /x2 points ss 2 sub get def
        /y2 points ss 1 sub get def
        /x3 x2 2 mul x1 sub def
        /y3 y2 y1 sub x2 x1 sub div y1 y0 sub x1 x0 sub div sub 2 mul
            x2 x1 sub dup mul x2 x0 sub div mul
            y2 2 mul add y1 sub def
        docurve
    } {
        ss 4 eq {
            points 0 get points 1 get moveto
            points 2 get points 3 get lineto
        } if
    } ifelse
    stroke
    grestore
} def }
%
%		#] makecurve :
%		#[ makedashcurve :
%
\special{! /makedashcurve{
%
%   Incoming stack:
%   [array of x,y pairs] dashsize width scale
%
    gsw /dsize ed /points ed
    /ss points length 2 idiv 2 mul def
    newpath
    ss 4 gt {
        /x1 points 0 get def
        /y1 points 1 get def
        /x2 points 2 get def
        /y2 points 3 get def
        /x3 points 4 get def
        /y3 points 5 get def
        /x0 x1 2 mul x2 sub def
        /y0 y3 y2 sub x3 x2 sub div y2 y1 sub x2 x1 sub div sub 2 mul
            x2 x1 sub dup mul x3 x1 sub div mul
            y1 2 mul add y2 sub def
        x1 y1 moveto
        docurve
        0 2 ss 8 sub { /ii ed
            /x0 points ii       get def
            /y0 points ii 1 add get def
            /x1 points ii 2 add get def
            /y1 points ii 3 add get def
            /x2 points ii 4 add get def
            /y2 points ii 5 add get def
            /x3 points ii 6 add get def
            /y3 points ii 7 add get def
            docurve
        } for
        /x0 points ss 6 sub get def
        /y0 points ss 5 sub get def
        /x1 points ss 4 sub get def
        /y1 points ss 3 sub get def
        /x2 points ss 2 sub get def
        /y2 points ss 1 sub get def
        /x3 x2 2 mul x1 sub def
        /y3 y2 y1 sub x2 x1 sub div y1 y0 sub x1 x0 sub div sub 2 mul
            x2 x1 sub dup mul x2 x0 sub div mul
            y2 2 mul add y1 sub def
        docurve
    } {
        ss 4 eq {
            points 0 get points 1 get moveto
            points 2 get points 3 get lineto
        } if
    } ifelse
    centerdash
    stroke
    grestore
} def }
%
\special{! /pathlength{
    flattenpath
    /dist 0 def
    { /yfirst ed /xfirst ed /ymoveto yfirst def /xmoveto xfirst def }
    { /ynext ed /xnext ed /dist dist ynext yfirst sub dup mul
        xnext xfirst sub dup mul add sqrt add def
        /yfirst ynext def /xfirst xnext def }
    {}
    {/ynext ymoveto def /xnext xmoveto def
        /dist ynext yfirst sub dup mul
              xnext xfirst sub dup mul add sqrt add def
        /yfirst ynext def /xfirst xnext def }
    pathforall
    dist
} def }
%
\special{! /centerdash{
    /pathlen pathlength def
    /jj pathlen dsize div 2.0 div cvi def
    /ddsize pathlen jj 2.0 mul div def
    [ddsize] ddsize 2 div setdash
} def }
%
%		#] makedashcurve :
%		#[ logaxis :
%
\special{! /logaxis{
%
%   Draws an axis from x1,y1 to x2,y2 with nl log divisions
%   size of the hashes hs, offset F
%   and width W. The stack looks like
%   x1,y1,x2,y2,nl,hs,F,W,scale
%   After the rotation the hash marks are on top if nl is positive and
%   on the bottom if nl is negative
%
    gsw /offset ed /hashsize ed /nlogs ed p2 p1
    x1 y1 translate
    /y2 y2 y1 sub def /x2 x2 x1 sub def
    y2 x2 atan rotate
    /rr x2 dup mul y2 dup mul add sqrt def
    offset 0 ne { /offset offset ln 10 ln div def } if
    /offset offset dup cvi sub def
    newpath
        0 0 moveto
        rr 0 lineto
    /lsize rr nlogs div def
    0 1 nlogs { /x2 ed
        x2 offset ge {
            /y2 x2 offset sub lsize mul def
            y2 rr le {
                y2 0 moveto
                y2 hashsize 1.2 mul lineto
            } if
        } if
    } for
    stroke
    width 0.6 mul setlinewidth
    newpath
    0 1 nlogs { /x2 ed
        2 1 9 {
            ln 10 ln div x2 add
            /xx2 ed
            xx2 offset ge {
                /y2 xx2 offset sub lsize mul def
                y2 rr le {
                    y2 0 moveto
                    y2 hashsize 0.8 mul lineto
                } if
            } if
        } for
    } for
    stroke
    grestore
} def }
%
%		#] logaxis :
%		#[ linaxis :
%
\special{! /linaxis{
%
%   x1,y1,x2,y2,num_decs,per_dec,hashsize,offset,width,scale
%
    gsw /offset ed /hashsize ed /perdec ed /numdec ed p2 p1
    x1 y1 translate
    /y2 y2 y1 sub def /x2 x2 x1 sub def
    y2 x2 atan rotate
    /rr x2 dup mul y2 dup mul add sqrt def
    newpath
        0 0 moveto
        rr 0 lineto
    /x1 rr numdec perdec mul div def
    /y1 rr numdec div def
    /offset offset x1 mul def 
    0 1 numdec { y1 mul offset sub
        dup 0 ge {
            dup rr le {
                dup 0 moveto
                hashsize 1.2 mul lineto
            } if
        } if
    } for
    stroke
    width 0.6 mul setlinewidth
    newpath
    offset cvi 1 numdec perdec mul offset add {
        x1 mul offset sub
        dup 0 ge {
            dup rr le {
                dup 0 moveto
                hashsize 0.8 mul lineto
            } if
        } if 
    } for
    stroke
    grestore
} def }
%
%		#] linaxis :
%		#[ LaTeX :
%
\def\axowidth{0.5 }
\def\axoscale{1.0 }
\def\axoxoff{0 }
\def\axoyoff{0 }
\def\axoxo{0 }
\def\axoyo{0 }
\def\sudocellsize{20 }
\def\firstcall{1}
%
\def\Gluon(#1,#2)(#3,#4)#5#6{
%
%   Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 #6 \axowidth \axoscale gluon showpage}}
}
%
\def\Photon(#1,#2)(#3,#4)#5#6{
%
%   Draws a photon from (x1,y1) to (x2,y2) with amplitude and number of windings
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 #6 \axowidth \axoscale photon showpage}}
}
%
\def\ZigZag(#1,#2)(#3,#4)#5#6{
%
%   Draws a zigzag from (x1,y1) to (x2,y2) with amplitude and number of zigzags
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 #6 \axowidth \axoscale zigzag showpage}}
}
%
\def\PhotonArc(#1,#2)(#3,#4,#5)#6#7{
%
%   Draws a photon on an arc segment. The center of the curve is at (1,2)
%   The radius, start angle and target angle are (#3,#4,#5), 6 is the
%   amplitude of the gluon, and 7 is the number of wiggles.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 #6 #7 \axowidth \axoscale photonarc showpage}}
}
%
\def\GlueArc(#1,#2)(#3,#4,#5)#6#7{
%
%   Draws a gluon on aa arc segment. The center of the curve is at (1,2)
%   The radius, start angle and target angle are (#3,#4,#5), 6 is the
%   amplitude of the gluon, and 7 is the number of windings.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 #6 #7 \axowidth \axoscale gluearc showpage}}
}
%
\def\ArrowArc(#1,#2)(#3,#4,#5){
%
%   Draws an arc segment with an arrow in it. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs anticlockwise
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 \axowidth \axoscale arrowarc showpage}}
}
%
\def\LongArrowArc(#1,#2)(#3,#4,#5){
%
%   Draws an arc segment with an arrow at its end. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs anticlockwise
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 \axowidth \axoscale longarrowarc showpage}}
}
%
\def\DashArrowArc(#1,#2)(#3,#4,#5)#6{
%
%   Draws a dashed arc segment with an arrow in it. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs anticlockwise
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 #6 \axowidth \axoscale dasharrowarc showpage}}
}
%
\def\ArrowArcn(#1,#2)(#3,#4,#5){
%
%   Draws an arc segment with an arrow in it. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs clockwise
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 \axowidth \axoscale arrowarcn showpage}}
}
%
\def\LongArrowArcn(#1,#2)(#3,#4,#5){
%
%   Draws an arc segment with an arrow at the end. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs clockwise
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 \axowidth \axoscale longarrowarcn showpage}}
}
%
\def\DashArrowArcn(#1,#2)(#3,#4,#5)#6{
%
%   Draws a dashed arc segment with an arrow in it. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs clockwise
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 #6 \axowidth \axoscale dasharrowarcn showpage}}
}
%
\def\ArrowLine(#1,#2)(#3,#4){
%
%   Draws a line with an arrow in it from (x1,y1) to (x2,y2)
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add \axowidth \axoscale arrowline showpage}}
}
%
\def\Cross(#1,#2)#3#4{
%
%   Draws a 45 degree cross at (x,y) {size} {width}
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 \axoscale cross showpage}}
}
%
\def\LongArrow(#1,#2)(#3,#4){
%
%   Draws a line with an arrow at the end from (x1,y1) to (x2,y2)
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add \axowidth \axoscale longarrow showpage}}
}
%
\def\DashArrowLine(#1,#2)(#3,#4)#5{
%
%   Draws a dashed line with an arrow in it from (x1,y1) to (x2,y2)
%   The size of the dashes is given by the fifth argument.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axowidth \axoscale dasharrowline showpage}}
}
%
\def\Line(#1,#2)(#3,#4){
%
%   Draws a line from (x1,y1) to (x2,y2)
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add \axowidth \axoscale line showpage}}
}
%
\def\DashLine(#1,#2)(#3,#4)#5{
%
%   Draws a line from (x1,y1) to (x2,y2) with a dash pattern of which the
%   alternating black and white pieces are approximately {5} points long
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axowidth \axoscale dashline showpage}}
}
%
\def\CArc(#1,#2)(#3,#4,#5){
%
%   Draws an arc segment. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs anticlockwise
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 \axowidth \axoscale carc showpage}}
}
%
\def\DashCArc(#1,#2)(#3,#4,#5)#6{
%
%   Draws a dashed arc segment. The center of the curve
%   is at (1,2).
%   The radius, start angle and target angle are (#3,#4,#5).
%   The arc segment runs anticlockwise
%   dsize (6) is the dashsize. this is rounded to make things come
%   out right.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 #4 #5 #6 \axowidth \axoscale dashcarc showpage}}
}
%
\def\Vertex(#1,#2)#3{
%
%   Draws a fat dot at (1,2). The radius of the dot is given by 3.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoscale vertex showpage}}
}
%
\def\Text(#1,#2)[#3]#4{
%
%   Draws text at (1,2). Argument 3 is l,r or c indicating whether
%   the text is left adjusted, right adjusted or centered.
%   4 is of course the text.
%
\dimen0=\axoxoff \unitlength
\dimen1=\axoyoff \unitlength
\advance\dimen0 by #1 \unitlength
\advance\dimen1 by #2 \unitlength
\makeatletter
\@killglue\raise\dimen1\hbox to\z@{\kern\dimen0 \makebox(0,0)[#3]{#4}\hss}
\ignorespaces
\makeatother
}
%
\def\BCirc(#1,#2)#3{
%
%   Draws a circle at (1,2) and radius 3 that is blanked out.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axowidth \axoscale bcirc showpage}}
}
%
\def\GCirc(#1,#2)#3#4{
%
%   Draws a circle at (1,2) and radius 3 that is blanked out.
%   Then it fills the circle with a gray scale 4 (0 = black, 1 is white)
%
\put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #2 \axoyo add #3
 #4 \axowidth \axoscale gcirc showpage}}
}
%
\def\CCirc(#1,#2)#3#4#5{
%
%   Draws a circle at (1,2) and radius 3 that is blanked out.
%   #4 is the color of the circle, #5 the color of the contents
%
\put(\axoxoff,\axoyoff){\special{"#5 #1 \axoxo add #2 \axoyo add #3
 \axowidth \axoscale ccirc1 showpage}}
\put(\axoxoff,\axoyoff){\special{"#4 #1 \axoxo add #2 \axoyo add #3
 \axowidth \axoscale ccirc2 showpage}}
}
%
\def\EBox(#1,#2)(#3,#4){
%
%   Draws a box with the left bottom at (x1,y1) and the right top
%   at (x2,y2).
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add \axowidth \axoscale box showpage}}
}
%
\def\BBox(#1,#2)(#3,#4){
%
%   Draws a box with the left bottom at (x1,y1) and the right top
%   at (x2,y2). The box is blanked out.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add \axowidth \axoscale bbox showpage}}
}
%
\def\GBox(#1,#2)(#3,#4)#5{
%
%   Draws a box with the left bottom at (x1,y1) and the right top
%   at (x2,y2). The box is blanked out and then filled with gray 5
%   (0 is black, 1 is white)
%
\put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axowidth \axoscale gbox showpage}}
}
%
\def\CBox(#1,#2)(#3,#4)#5#6{
%
%   Draws a box with the left bottom at (x1,y1) and the right top
%   at (x2,y2). The color of the box is #5, the background is #6
%
\put(\axoxoff,\axoyoff){\special{"#6 #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add \axowidth \axoscale cbox1 showpage}}
\put(\axoxoff,\axoyoff){\special{"#5 #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add \axowidth \axoscale cbox2 showpage}}
}
%
\def\Boxc(#1,#2)(#3,#4){
%
%   Draws a box with the center at (x1,y1).
%   The width and height are (3,4).
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #3 2 div sub #2 \axoyo add
 #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
 \axowidth \axoscale box showpage}}
}
%
\def\BBoxc(#1,#2)(#3,#4){
%
%   Draws a box with the center at (x1,y1).
%   The width and height are (3,4). The contents are blanked out
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #3 2 div sub #2 \axoyo add
 #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
 \axowidth \axoscale bbox showpage}}
}
%
\def\GBoxc(#1,#2)(#3,#4)#5{
%
%   Draws a box with the center at (x1,y1).
%   The width and height are (3,4). The contents are blanked out
%   Then the contents are filled with gray 5 (0 is black, 1 is white)
%
\put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #3 2 div sub #2 \axoyo add
 #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
 #5 \axowidth \axoscale gbox showpage}}
}
%
\def\CBoxc(#1,#2)(#3,#4)#5#6{
%
%   Draws a box with the center at (x1,y1).
%   The width and height are (3,4). The contents are blanked out
%   The color of the box is #5, the background is #6
%
\put(\axoxoff,\axoyoff){\special{"#6 #1 \axoxo add #3 2 div sub #2 \axoyo add
 #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
 \axowidth \axoscale cbox1 showpage}}
\put(\axoxoff,\axoyoff){\special{"#5 #1 \axoxo add #3 2 div sub #2 \axoyo add
 #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
 \axowidth \axoscale cbox2 showpage}}
}
%
\def\ETri(#1,#2)(#3,#4)(#5,#6){
%
%   Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
 \axowidth \axoscale triangle showpage}}
}
%
\def\BTri(#1,#2)(#3,#4)(#5,#6){
%
%   Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
%   The triangle is blanked out.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
 \axowidth \axoscale btriangle showpage}}
}
%
\def\GTri(#1,#2)(#3,#4)(#5,#6)#7{
%
%   Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
%   The triangle is blanked out and then filled with gray 7
%   (0 is black, 1 is white)
%
\put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add #7
 \axowidth \axoscale gtriangle showpage}}
}
%
\def\CTri(#1,#2)(#3,#4)(#5,#6)#7#8{
%
%   Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
%   The color of the box is #7, the background is #8
%
\put(\axoxoff,\axoyoff){\special{"#8 #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
 \axowidth \axoscale ctriangle1 showpage}}
\put(\axoxoff,\axoyoff){\special{"#7 #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
 \axowidth \axoscale ctriangle2 showpage}}
}
%
\def\SetWidth#1{\def\axowidth{#1 }}
\def\SetScale#1{\def\axoscale{#1 }}
\def\SetOffset(#1,#2){\global\def\axoxoff{#1 } \global\def\axoyoff{#2 }}
\def\SetScaledOffset(#1,#2){\def\axoxo{#1 } \def\axoyo{#2 }}
\def\SetCellSize#1{\global\def\sudocellsize{#1 }}
%
\def\pfont{Times-Roman }
\def\fsize{10 }
%
\def\SetPFont#1#2{\def\pfont{#1 } \def\fsize{#2 }}
%
%   Now some definitions to sort out the lt etc type of options in PText
%
\makeatletter
\def\fmode{4 }
\def\@l@{l} \def\@r@{r} \def\@t@{t} \def\@b@{b}
\def\mymodetest#1{\ifx#1\end \let\next=\relax \else {
\if#1\@r@\global\def\fmodeh{1 }\fi
\if#1\@l@\global\def\fmodeh{-1 }\fi
\if#1\@b@\global\def\fmodev{3 }\fi
\if#1\@t@\global\def\fmodev{-3 }\fi
} \let\next=\mymodetest\fi \next}
\makeatother
%
\def\PText(#1,#2)(#3)[#4]#5{
%
%   Draws a postscript text in a postscript font.
%   Focal point is (1,2), rotation angle is 3, 4 is the mode (as in text)
%   and 5 is the text.
%
\def\fmodev{0 }
\def\fmodeh{0 }
\mymodetest#4\end
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont \fsize
 scalefont setfont \axocolor #1 \axoxo add #2 \axoyo add #3
\fmode \fmodev add \fmodeh add \fsize (#5) \axoscale ptext }}}
}
%
\def\GOval(#1,#2)(#3,#4)(#5)#6{
%
%   Draws a colored oval that overwrites whatever was there.
%   Oval(x_center,y_center)(height,width)(rotation)(color)
%
\put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #2 \axoyo add #3 #4 #5 #6
\axowidth \axoscale goval showpage}}
}
%
\def\COval(#1,#2)(#3,#4)(#5)#6#7{
%
%   Draws a colored oval that overwrites whatever was there.
%   Oval(x_center,y_center)(height,width)(rotation){color1}{color2}
%
\put(\axoxoff,\axoyoff){\special{"#7 #1 \axoxo add #2 \axoyo add #3 #4 #5
\axowidth \axoscale coval1 showpage}}
\put(\axoxoff,\axoyoff){\special{"#6 #1 \axoxo add #2 \axoyo add #3 #4 #5
\axowidth \axoscale coval2 showpage}}
}
%
\def\Oval(#1,#2)(#3,#4)(#5){
%
%   Draws an oval that does not overwrite whatever was there.
%   Oval(x_center,y_center)(height,width)(rotation)
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3 #4 #5
\axowidth \axoscale oval showpage}}
}
%
\let\eind=]
\def\DashCurve#1#2{\put(\axoxoff,\axoyoff){\special{"\axocolor  [ \kromme#1] #2
\axowidth \axoscale makedashcurve showpage}}}
\def\Curve#1{\put(\axoxoff,\axoyoff){\special{"\axocolor [ \kromme#1] \axowidth
\axoscale makecurve showpage}}}
\def\kromme(#1,#2)#3{#1 \axoxo add #2 \axoyo add \ifx #3\eind\else
\expandafter\kromme\fi#3}
%
\def\LogAxis(#1,#2)(#3,#4)(#5,#6,#7,#8){
%
%   Draws a line with logarithmic hash marks along it.
%   LogAxis(x1,y1)(x2,y2)(num_logs,hashsize,offset,width)
%   The line is from (x1,y1) to (x2,y2) and the marks are on the left side
%   when hashsize is positive, and right when it is negative.
%   num_logs is the number of orders of magnitude and offset is the number
%   at which one starts at (x1,y1) (like if offset=2 we start at 2)
%   When offset is 0 we start at 1. Width is the linewidth.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 #6 #7 #8 \axoscale logaxis showpage}}
}
%
\def\LinAxis(#1,#2)(#3,#4)(#5,#6,#7,#8,#9){
%
%   Draws a line with linear hash marks along it.
%   LinAxis(x1,y1)(x2,y2)(num_decs,per_dec,hashsize,offset,width)
%   The line is from (x1,y1) to (x2,y2) and the marks are on the left side
%   when hashsize is positive, and right when it is negative.
%   num_decs is the number of accented marks, per_dec the number of
%   divisions between them and offset is the number
%   at which one starts at (x1,y1) (like if offset=2 we start at the second
%   small mark) Width is the linewidth.
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
 \axoxo add #4 \axoyo add #5 #6 #7 #8 #9 \axoscale linaxis showpage}}
}
%
\input rotate.tex
\makeatletter
%
\def\rText(#1,#2)[#3][#4]#5{
%
%   Draws rotated text at (1,2). Argument 3 is l,r or c indicating whether
%   the text is left adjusted, right adjusted or centered.
%   4 is the rotation angle and 5 is of course the text.
%
\ifnum\firstcall=1\global\def\firstcall{0}\rText(-10000,#2)[#3][]{#5}\fi
\dimen2=\axoxoff \unitlength
\dimen3=\axoyoff \unitlength
\advance\dimen2 by #1 \unitlength
\advance\dimen3 by #2 \unitlength
\@killglue\raise\dimen3\hbox to \z@{\kern\dimen2
\makebox(0,0)[#3]{
\ifx#4l{\setbox3=\hbox{#5}\rotl{3}}\else{
\ifx#4r{\setbox3=\hbox{#5}\rotr{3}}\else{
\ifx#4u{\setbox3=\hbox{#5}\rotu{3}}\else{#5}\fi}\fi}\fi}\hss}
\ignorespaces
}
\makeatother
%
\def\BText(#1,#2)#3{
%
%   Draws a box with the center at (x1,y1) and postscript text in it.
%
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont \axocolor #1 \axoxo add #2 \axoyo add (#3)
 \fsize \axowidth \axoscale btext showpage}}
}
%
\def\GText(#1,#2)#3#4{
%
%   Draws a box with the center at (x1,y1) and postscript(#4) text in it.
%   The grayness of the box is given by #3
%
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont #1 \axoxo add #2 \axoyo add #3 (#4)
 \fsize \axowidth \axoscale gtext showpage}}
}
%
\def\CText(#1,#2)#3#4#5{
%
%   Draws a box with the center at (x1,y1) and postscript(#5) text in it.
%   The color of box and text is in #3
%   The color of the background is in #4
%
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont #4 #1 \axoxo add #2 \axoyo add (#5)
 \fsize \axowidth \axoscale ctext1 showpage}}
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont #3 #1 \axoxo add #2 \axoyo add (#5)
 \fsize \axowidth \axoscale ctext2 showpage}}
}
%
\def\B2Text(#1,#2)#3#4{
%
%   Draws a box with the center at (x1,y1) and two lines of postscript
%   text in it.
%
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont \axocolor #1 \axoxo add #2 \axoyo add (#3) (#4)
 \fsize \axowidth \axoscale b2text showpage}}
}
%
\def\G2Text(#1,#2)#3#4#5{
%
%   Draws a box with the center at (x1,y1) and two lines of postscript
%   text (#4 and #5) in it.
%   The grayness of the box is given by #3
%
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont #1 \axoxo add #2 \axoyo add #3 (#4) (#5)
 \fsize \axowidth \axoscale g2text showpage}}
}
%
\def\C2Text(#1,#2)#3#4#5#6{
%
%   Draws a box with the center at (x1,y1) and two lines of postscript
%   text (#5 and #6) in it.
%   The color of the box and the text is given by #3
%   The background color is given by #4
%
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont #4 #1 \axoxo add #2 \axoyo add (#5) (#6)
 \fsize \axowidth \axoscale c2text1 showpage}}
\put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
 scalefont setfont #3 #1 \axoxo add #2 \axoyo add (#5) (#6)
 \fsize \axowidth \axoscale c2text2 showpage}}
}
%
%	Below follow some primitives for creating sudoku outputs
%	1: MakeBoard(x_left_under,y_left_under,cellsize)
%	2: PutCell(i,j,number)   Note: i=1,...,9; 1 is at the top
%	3: PutAllow(i,j,number)  Puts a small number in cell i,j in the proper position
%	4: PutScratch(i,j,number)Same as PutAllow but crosses it out.
%
\def\MakeBoard(#1,#2,#3){
%
%	Draws a sudoku board with cellsize #3 at origin (#1,#2).
%	Defines the cellsize for later use
%	Sets the origin of the board at 0,0 via the offset mechanism!!!
%
{\def\sudocellsize{#3}}
%\SetOffset(#1,#2)
\global\def\axoxoff{#1 }
\global\def\axoyoff{#2 }
{\def\pfont{Helvetica }}
{\def\fsize{#3 }}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add 0 \axoyo add #3 9 mul
 \axoxo add #3 9 mul \axoyo add \axowidth 3 mul \axoscale box showpage}}
%
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 \axoyo add #3 9 mul
 \axoxo add #3 \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 2 mul \axoyo add #3 9 mul
 \axoxo add #3 2 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 3 mul \axoyo add #3 9 mul
 \axoxo add #3 3 mul \axoyo add \axowidth 3 mul \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 4 mul \axoyo add #3 9 mul
 \axoxo add #3 4 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 5 mul \axoyo add #3 9 mul
 \axoxo add #3 5 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 6 mul \axoyo add #3 9 mul
 \axoxo add #3 6 mul \axoyo add \axowidth 3 mul \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 7 mul \axoyo add #3 9 mul
 \axoxo add #3 7 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor 0 \axoxo add #3 8 mul \axoyo add #3 9 mul
 \axoxo add #3 8 mul \axoyo add \axowidth \axoscale line showpage}}
%
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 \axoxo add 0 \axoyo add #3
 \axoxo add #3 9 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 2 mul \axoxo add 0 \axoyo add #3 2 mul
 \axoxo add #3 9 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 3 mul \axoxo add 0 \axoyo add #3 3 mul
 \axoxo add #3 9 mul \axoyo add \axowidth 3 mul \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 4 mul \axoxo add 0 \axoyo add #3 4 mul
 \axoxo add #3 9 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 5 mul \axoxo add 0 \axoyo add #3 5 mul
 \axoxo add #3 9 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 6 mul \axoxo add 0 \axoyo add #3 6 mul
 \axoxo add #3 9 mul \axoyo add \axowidth 3 mul \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 7 mul \axoxo add 0 \axoyo add #3 7 mul
 \axoxo add #3 9 mul \axoyo add \axowidth \axoscale line showpage}}
\put(\axoxoff,\axoyoff){\special{"\axocolor #3 8 mul \axoxo add 0 \axoyo add #3 8 mul
 \axoxo add #3 9 mul \axoyo add \axowidth \axoscale line showpage}}
}
%
\def\SetCoordinates{
\def\fmodev{0 }
\def\fmodeh{0 }
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont
 \sudocellsize 0.5 mul scalefont setfont
	\axocolor -0.5 \sudocellsize mul \axoxo add 0.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (9) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 1.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (8) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 2.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (7) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 3.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (6) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 4.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (5) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 5.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (4) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 6.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (3) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 7.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (2) \axoscale ptext
	\axocolor -0.5 \sudocellsize mul \axoxo add 8.58 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (1) \axoscale ptext
	\axocolor  0.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (A) \axoscale ptext
	\axocolor  1.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (B) \axoscale ptext
	\axocolor  2.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (C) \axoscale ptext
	\axocolor  3.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (D) \axoscale ptext
	\axocolor  4.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (E) \axoscale ptext
	\axocolor  5.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (F) \axoscale ptext
	\axocolor  6.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (G) \axoscale ptext
	\axocolor  7.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (H) \axoscale ptext
	\axocolor  8.5 \sudocellsize mul \axoxo add 9.50 \sudocellsize mul \axoyo add
		0 \fmode \fmodev add \fmodeh add \sudocellsize 0.5 mul (I) \axoscale ptext
}}}
}

%
\def\ColorCell(#1,#2)#3{
%
%	Colors the background of a cell in color #3
%
\def\fmodev{0 }
\def\fmodeh{0 }
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"#3
	#2 1 sub \sudocellsize mul \axoxo add
	9 #1 sub \sudocellsize mul \axoyo add
	#2 \sudocellsize mul \axoxo add
	10 #1 sub \sudocellsize mul \axoyo add
	\axowidth \axoscale cbox1 showpage}}}
}
\def\PutCell(#1,#2,#3){
%
%	Puts a number in a cell i,j. Note: i,j count 1,...,9. i=1 is at the top.
%
\def\fmodev{0 }
\def\fmodeh{0 }
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont
 \sudocellsize 0.8 mul scalefont setfont \axocolor
 #2 0.5 sub \sudocellsize mul \axoxo add
 9.65 #1 sub \sudocellsize mul \axoyo add
 0 \fmode \fmodev add \fmodeh add \sudocellsize 0.8 mul (#3) \axoscale ptext }}}
}
%
\def\PutAllow(#1,#2,#3){
%
%	For a registration of allowed numbers. Puts a small number in cell i,j
%	The number is in a fixed position depending on its value:
%		1 2 3
%		4 5 6
%		7 8 9
%
\def\fmodev{0 }
\def\fmodeh{0 }
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont
 \sudocellsize 0.3 mul scalefont setfont \axocolor
 #2 1 sub #3 1 sub #3 2 sub 3.0 div round 3 mul sub 0.5 add 3.0 div add \sudocellsize mul \axoxo add
 9.05 #1 sub 8 #3 sub 3.0 div round 0.5 add 3.0 div add \sudocellsize mul \axoyo add
 0 \fmode \fmodev add \fmodeh add \sudocellsize 0.3 mul (#3) \axoscale ptext }}}
}
%
\def\PutScratch(#1,#2,#3){
%
%	For a registration of allowed numbers. Puts a small number in cell i,j
%	The number is in a fixed position depending on its value:
%		1 2 3
%		4 5 6
%		7 8 9
%	The number given is however crossed out. This is to guide the eye in
%	seeing which numbers vanished.
%
\def\fmodev{0 }
\def\fmodeh{0 }
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont
 \sudocellsize 0.3 mul scalefont setfont \axocolor
 #2 1 sub #3 1 sub #3 2 sub 3.0 div round 3 mul sub 0.5 add 3.0 div add \sudocellsize mul \axoxo add
 9.05 #1 sub 8 #3 sub 3.0 div round 0.5 add 3.0 div add \sudocellsize mul \axoyo add
 0 \fmode \fmodev add \fmodeh add \sudocellsize 0.3 mul (#3) \axoscale ptext}}}
\put(\axoxoff,\axoyoff){\special{"\axocolor
 #2 1 sub #3 1 sub #3 2 sub 3.0 div round 3 mul sub 0.5 add 3.0 div add \sudocellsize mul \axoxo add
 9. #1 sub 8 #3 sub 3.0 div round 0.5 add 3.0 div add \sudocellsize mul \axoyo add
	\sudocellsize 8 div \axowidth 0.7 mul \axoscale cross showpage}}
}
%
\def\PutSudoCirc(#1,#2,#3){
%
%	For a registration of allowed numbers. Puts a small number in cell i,j
%	The number is in a fixed position depending on its value:
%		1 2 3
%		4 5 6
%		7 8 9
%	Around the number is however a little circle. This is to guide the eye in
%	seeing which numbers vanished.
%
\def\fmodev{0 }
\def\fmodeh{0 }
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont
 \sudocellsize 0.3 mul scalefont setfont \axocolor
 #2 1 sub #3 1 sub #3 2 sub 3.0 div round 3 mul sub 0.5 add 3.0 div add \sudocellsize mul \axoxo add
 9.05 #1 sub 8 #3 sub 3.0 div round 0.5 add 3.0 div add \sudocellsize mul \axoyo add
 0 \fmode \fmodev add \fmodeh add \sudocellsize 0.3 mul (#3) \axoscale ptext}}}
\put(\axoxoff,\axoyoff){\special{"\axocolor
 #2 1 sub #3 1 sub #3 2 sub 3.0 div round 3 mul sub 0.5 add 3.0 div add \sudocellsize mul \axoxo add
 9. #1 sub 8 #3 sub 3.0 div round 0.5 add 3.0 div add \sudocellsize mul \axoyo add
	\sudocellsize 6 div \axowidth \axoscale ccirc2 showpage}}
}
%
\def\PutSudoColor(#1,#2,#3)#4{
%
%	For a registration of allowed numbers. Puts a small number in cell i,j
%	The number is in a fixed position depending on its value:
%		1 2 3
%		4 5 6
%		7 8 9
%	The number is in a colored little square
%
\def\fmodev{0 }
\def\fmodeh{0 }
\put(\axoxoff,\axoyoff){\special{"#4
 #2 1 sub #3 1 sub #3 2 sub 3.0 div round 3 mul sub 0.5 add 3.0 div add \sudocellsize mul \axoxo add
 9. #1 sub 8 #3 sub 3.0 div round 0.5 add 3.0 div add \sudocellsize mul \axoyo add
	\sudocellsize 6 div \axowidth \axoscale cbox3 showpage}}
\put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont
 \sudocellsize 0.3 mul scalefont setfont \axocolor
 #2 1 sub #3 1 sub #3 2 sub 3.0 div round 3 mul sub 0.5 add 3.0 div add \sudocellsize mul \axoxo add
 9.05 #1 sub 8 #3 sub 3.0 div round 0.5 add 3.0 div add \sudocellsize mul \axoyo add
 0 \fmode \fmodev add \fmodeh add \sudocellsize 0.3 mul (#3) \axoscale ptext}}}
}
%
%		#] LaTeX :

